package com.lemon.cloud.admin.dto;

import cn.hutool.core.bean.BeanUtil;
import com.amazonaws.services.s3.model.PartSummary;
import com.lemon.cloud.admin.entity.SysFileUploadTask;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

@Data
public class TaskRecordDTO implements Serializable {
    /**
     * 已上传完的分片
     */
    @Schema(description = "已上传完的分片")
    private List<PartSummary> exitPartList;

    @Schema(description = "已上传完的分片")
    private Integer chunkNum;

    /**
     * 文件大小（byte）
     */
    @Schema(description = "文件大小")
    private Long fileSize;

    /**
     * 每个分片大小（byte）
     */
    @Schema(description = "每个分片大小")
    private Long chunkSize;

    @Schema(description = "文件唯一标识")
    private String identifier;

    public static TaskRecordDTO convertFromEntity(SysFileUploadTask task) {
        TaskRecordDTO dto = new TaskRecordDTO();
        BeanUtil.copyProperties(task, dto);
        return dto;
    }

}
